/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package uk.surrey.ash.ga;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

/**
 * @author Ashish
 *
 */
public class HashCode {
	private ArrayList<Integer> hashcode = new ArrayList<Integer>();

	/**
	 * @param hashcode the hashcode to set
	 * @throws IOException 
	 */
	public void setHashcode(String filename) throws IOException {
		File file = new File(filename);
		FileReader fr = new FileReader(file);
		BufferedReader br = new BufferedReader(fr);
		if(br.ready()){
			for(;;){
				String str = br.readLine();
				if(str==null){
					break;
				}
				else{
					hashcode.add(Integer.valueOf(str));
				}
			}
		}
		
	}

	/**
	 * @param filename 
	 * @return the hashcode
	 */
	public ArrayList<Integer> getHashcode() {
		return hashcode;
	}

	/**
	 * @return
	 */
	public Integer getMax() {
		Object obj = Collections.max(hashcode);
		return (Integer) obj;
	}
	

}
